#/usr/bin/local/python3  指定解释器
#查看help.string:         帮助文档
'''
import _string

# Some strings for ctype-style character classification
whitespace = ' \t\n\r\v\f'
ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_letters = ascii_lowercase + ascii_uppercase
digits = '0123456789'
hexdigits = digits + 'abcdef' + 'ABCDEF'
octdigits = '01234567'
punctuation = r"""!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~"""
printable = digits + ascii_letters + punctuation + whitespace'''

from string import ascii_letters, digits  #导入模块
from random import choice

zifuji = ascii_letters + digits            #定义全局变量
                                            #定义类
def suiji_zifu(n=8):                        #定义函数

    result = ''
    for i in range(n):
        zifu = choice(zifuji)
        result += zifu
    return result



if __name__ == '__main__':                  #主程序编码
    s1 = suiji_zifu()
    s2 = suiji_zifu(4)
    with open('/tmp/zifu.txt','w') as fobj:
        fobj.write(s1)

    print(s2)


f =open('/tmp/mima')
for line in f:
    print(line,end='')
f.close()
